#!/bin/bash

# 检查Python环境
if command -v python3 &> /dev/null; then
    echo "检测到Python，开始启动浏览器..."
    
    # 检查PyQt6和PyQt6-WebEngine是否已安装
    if python3 -c "import PyQt6, PyQt6.QtWebEngineWidgets" &> /dev/null; then
        echo "PyQt6依赖已满足，启动浏览器中..."
    else
        echo "正在安装PyQt6相关依赖..."
        pip install -r requirements_pyqt6.txt
        if [ $? -ne 0 ]; then
            echo "依赖安装失败，请手动执行: pip install -r requirements_pyqt6.txt"
            exit 1
        fi
    fi
    
    # 启动浏览器
    python3 main_pyqt6.py
else
    echo "错误: 未检测到Python环境，请安装Python 3.6+"
    exit 1
fi